/*
package com.tzy.for10evalue.utils;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import redis.clients.jedis.Jedis;
import redis.clients.jedis.JedisPool;

public class RedisUtil {

    private static JedisPool pool;
    private static Logger logger = LoggerFactory.getLogger(RedisUtil.class);

    */
/**
     * setnx
     *//*

    public static Integer setnx(String key, String value, Integer second) {
        Jedis jedis = null;
        try {
            jedis = getPool().getResource();
            Long res = jedis.setnx(key, value);
            if (res == 1) {
                jedis.expire(key, second);
                return 1;
            }
            return 0;
        } catch (Exception e) {
            logger.error("redis setnx出错... key:{}", key, e);
        } finally {
            if (jedis != null) {
                jedis.close();
            }
        }
        return 1;
    }

    */
/**
     * 加锁 sencond秒内不能再次请求
     *
     * @param key
     * @return true 可以操作
     * false 已加锁不能操作
     *//*

    public static Boolean getLock(String key, Integer second) {
        JedisPool pool = RedisUtils.getPool();
        Jedis jedis = null;
        try {
            jedis = pool.getResource();
            Long result = jedis.setnx(key, "true");
            if (result == 0) {
                return false;
            } else {
                jedis.expire(key, second);
                return true;
            }
        } catch (Exception e) {
            logger.error("error", e);
        } finally {
            if (jedis != null) {
                jedis.close();
            }
        }
        return true;
    }

    */
/**
     * 新增key
     *
     * @param key
     * @param second
     *//*

    public static void addKey(String key, Integer second) {
        JedisPool pool = RedisUtils.getPool();
        Jedis jedis = null;
        try {
            jedis = pool.getResource();
            jedis.set(key, "true");
            jedis.expire(key, second);
        } catch (Exception e) {
            logger.error("error", e);
        } finally {
            if (jedis != null) {
                jedis.close();
            }
        }
    }

    */
/**
     * key是否存在
     *
     * @param key
     * @return
     *//*

    public static boolean existsKey(String key) {
        JedisPool pool = RedisUtils.getPool();
        Jedis jedis = null;
        try {
            jedis = pool.getResource();
            return jedis.exists(key);
        } catch (Exception e) {
            logger.error("error", e);
        } finally {
            if (jedis != null) {
                jedis.close();
            }
        }
        return false;
    }




    */
/**
     * delete
     * @param key
     *//*

    public static void delete(String key){
        Jedis jedis = null;
        try {
            jedis = getPool().getResource();
            jedis.del(key);
        } catch (Exception e) {
            logger.error("redis delete出错... key:{}", key, e);
        } finally {
            if (jedis != null) {
                jedis.close();
            }
        }
    }

    private static JedisPool getPool() {
        if (pool != null) return pool;
        synchronized (RedisUtil.class) {
            if (pool == null) {
                pool = RedisUtils.getPool();
            }
        }
        return pool;
    }


}
*/
